package mockZijie.no1;

class Solution {
    public boolean validMountainArray(int[] arr) {
        if(arr.length<3)
            return false;
        boolean flag = true;
        boolean flag2 = false;
        for (int i = 0; i < arr.length-1; i++) {
            if (arr[i]==arr[i+1]){
                return false;
            }
            if (arr[i]<arr[i+1]){
                flag2 =true;
            }
            if (flag == true){
                if (arr[i]>arr[i+1]){
                    flag = false;
                }

            }else if (flag == false){
                if (arr[i]<arr[i+1]){
                    return false;
                }
            }
        }
        return flag != true && flag2;
    }
}